﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using SKBKontur.Serialization.Binding;

namespace SKBKontur.Logging.Model
{
    [DataContract]
    public class LogEvent
    {
        public LogEvent(): this(null)
        {
        }

        public LogEvent(Exception exception)
        {
            TimeStamp = DateTime.Now;
            if (exception != null)
                LogException = new LogException(exception);
        }

//        [Utf8StringDictionaryBinder("ParametersIndexer")]
//        public string this[string name]
//        {
//            get { return Parameters[name]; }
//            set { Parameters[name] = value; }
//        }
//
//        [DataMember]
//        private Dictionary<String, String> Parameters = new Dictionary<string, string>();

        [DataMember]
        public LogException LogException { get; set; }

        [DataMember]
        [Utf8StringBinder]
        public string Message { get; set; }

        [DataMember]
        [DateTimeBinder]
        public DateTime TimeStamp { get; set; }

        [DataMember]
        [EnumBinder]
        public LogEventLevel EventLevel { get; set; }
    }
}